
res_nocv<-read.csv(file="resultsK0.csv")



pd<-paste(wd, "/Figures/Figures_Output/",sep="")

pdf(file=paste(pd,"learning_plot.pdf",sep=""), 6, 6)


par(mar=c(2,4,2,1))

plot(res_nocv$years,res_nocv$pD_hat,type="n",lwd=2,col="Dark Blue",axes=F,ylim=c(.25,.575),xlab="",ylab="% World Democracies")


grid()

polygon(c(2000,2012,2012,2000),c(.22,.22,.6,.6),col=rgb(.1,.1,.1,.1),border="NA")




lines(res_nocv$years[res_nocv$years < 2001],res_nocv$pD_hat[res_nocv$years < 2001],lwd=2,col="Dark Blue")

lines(res_nocv$years[res_nocv$years >= 2001],res_nocv$pD_hat[res_nocv$years >= 2001],lwd=2,lty=2,col="Dark Blue")



lines(res_nocv$years,res_nocv$pD,lwd=2,col=rgb(.1,.1,.1,.75))

axis(1);axis(2,at=seq(0,1,by=.05),labels=seq(0,100,by= 5))

mtext("No Covariates",font=2,line=0,cex=1.75)


res_nocvnl<-read.csv(file="resultsK0nl.csv")


lines(res_nocvnl$years[res_nocvnl$years < 2001],res_nocvnl$pD_hat[res_nocvnl$years < 2001],lwd=2,col="Dark Red")

lines(res_nocvnl$years[res_nocvnl$years >= 2001],res_nocvnl$pD_hat[res_nocvnl$years >= 2001],lwd=2,lty=2,col="Dark Red")



text(2006,.26,"Out of",cex=1)
text(2006,.25,"Sample",cex=1)

text(1993,.25,"In Sample",cex=1)


text(1987.5,.51,"True Value",cex=1)


text(2002.5,.45,"Model w/ Learning",cex=1)

text(2001,.305,"Model w/ No Learning",cex=1)



dev.off()

#########################




pdf(file=paste(pd,"learning_plot2.pdf",sep=""), 6, 6)

res_2cv<-read.csv(file="resultsK2.csv")



par(mar=c(2,4,2,1))

plot(res_2cv$years,res_2cv$pD_hat,type="n",lwd=2,col="Dark Blue",axes=F,ylim=c(.25,.575),xlab="",ylab="% World Democracies")


grid()

polygon(c(2000,2012,2012,2000),c(.22,.22,.6,.6),col=rgb(.1,.1,.1,.1),border="NA")




lines(res_2cv$years[res_2cv$years < 2001],res_2cv$pD_hat[res_2cv$years < 2001],lwd=2,col="Dark Blue")

lines(res_2cv$years[res_2cv$years >= 2001],res_2cv$pD_hat[res_2cv$years >= 2001],lwd=2,lty=2,col="Dark Blue")



lines(res_2cv$years,res_2cv$pD,lwd=2,col=rgb(.1,.1,.1,.75))

axis(1);axis(2,at=seq(0,1,by=.05),labels=(seq(0,100,by=5)))

mtext("Two Covariates",font=2,line=0,cex=1.75)
mtext("Time in Power, ln(GDPpc)",font=1,line=-.95,cex=.95)

res_2cvnl<-read.csv(file="resultsK2nl.csv")


lines(res_2cvnl$years[res_2cvnl$years < 2001],res_2cvnl$pD_hat[res_2cvnl$years < 2001],lwd=2,col="Dark Red")

lines(res_2cvnl$years[res_2cvnl$years >= 2001],res_2cvnl$pD_hat[res_2cvnl$years >= 2001],lwd=2,lty=2,col="Dark Red")





dev.off()

